<include file="Article:leftmenu" />
<div class="content-right fl">


	<h1 class="content-right-title">
	</h1>


	<!-- <a href="/admin/add" class="btn btn-success">发布文章</a>-->

	<form action="" method="get">
		<div class="tables-searchbox newcearchbox">
		

			<select name="atype_id" class="select small newselect">
				<option value="" selected="">所有分类</option>
				<?php foreach($atype as $k=>$v){ ?>
				<option value="<?php echo $v['atype_id'];?>"  <?php echo $v['atype_id']==get('atype_id')?"selected":"";?>><?php echo $v['atype_name'];?></option>
				<?php } ?>
			</select>

			
			<input type="text" placeholder="输入文章标题" class="input" name="title" value="<?php echo get('title');?>">
			<button class="btn btn-primary" style="line-height: 26px;">
				<i class="gicon-search white"></i>查询
			</button>
			<a href="/admin/article/index" class="btn btn-primary vtal-2">清除查询</a>
		</div>
		<div class="tabs clearfix mgt10">
			<a href="/admin/article/index" class="<?php echo ($action=="index")?"active":'';?> tabs_a fl">已发布(<?php echo $article_count[1];?>)</a>
			<a href="/admin/article/waitpass" class="<?php echo ($action=="waitpass")?"active":'';?> tabs_a fl">待审核(<?php echo $article_count[2];?>)</a>
			<a href="/admin/article/nopass" class=" <?php echo ($action=="nopass")?"active":'';?> tabs_a fl">未通过(<?php echo $article_count[3];?>)</a>
			<a href="/admin/article/dellist" class="<?php echo ($action=="dellist")?"active":'';?> tabs_a fl">已删除(<?php echo $article_count[4];?>)</a>
		</div>
	</form>
	<!-- end tabs -->

	<table class="wxtables mgt10">
		<colgroup>
			<!-- <col width="2%">-->
			<col width="10%">
			<col width="8%">
			<col width="17%">
			<col width="10%">
			<col width="8%">
			<col width="8%">
			<col width="8%">
			<col width="27%">
		</colgroup>
		<thead>
			<tr class="po_list">
				<!--  <td><i class="icon_check"></i></td>-->
				<td>文章编号<span></span></td>
				<td>图片<span></span></td>
				<td>文章名称<span></span></td>
				<td>文章分类<span></span></td>
				<td>创建时间<span></span></td>
				<td>排序<span></span></td>
				<td>链接<span></span></td>
				<td>操作<span></span></td>
			</tr>
		</thead>
		<tbody>
		
<?php foreach($datalist as $k=>$v){?>
		
			<tr>
				<!--  <td><input type="checkbox" class="checkbox table-ckbs" data-id="2416530"></td>-->
				<td><?php echo $v['article_id'];?></td>
				<td><img src="<?php echo C("UPYUN_DOMAIN").$v['thumb'];?>!headimgurl"  width="60" height="60"  onerror="javascript:this.src='__STATIC__admin/images/error.png';">
				</td>
				<td><a href="javascript:chakan(<?php echo $v['article_id'];?>)" class="block" target="_blank">
				<div class="table-item-info" style="width: 210px;">
				<p><?php echo $v['title'];?></p>
				</div>
				</a>
				</td>
				<td><?php echo ($v['atype_id']) ? ($atype[$v['atype_id']]['atype_name'] ? $atype[$v['atype_id']]['atype_name'] : '未分类') : "未分类";?></td>
				<td><?php echo $v['create_time'];?></td>
				<td><?php echo $v['ord'];?></td>
				<td>
<?php echo get_domain();?>/mobile/article?article_id=<?php echo $v['article_id'];?></td>
				<td>
				
				<a href="javascript:chakan(<?php echo $v['article_id'];?>)" class="btn width" title="">查看</a> 
				
				<a href="/admin/article/edit/?article_id=<?php echo $v['article_id'];?>" class="btn width" title="修改">编辑</a> 
				
				<a href="/admin/article/editdetail/?article_id=<?php echo $v['article_id'];?>" class="btn width" title="修改">编辑详情</a> 
				
				<?php if($v['status'] == 1){?>
					<a href="javascript:del('<?php echo $v['article_id'];?>',0);" class="btn j-del" title="删除">删除</a>
				<?php }else{?>
					<a href="javascript:del('<?php echo $v['article_id'];?>',1);" class="btn j-del" title="删除">恢复</a>
				<?php }?>
				
				
				<?php if($v['is_check'] != 1){?>
					<a href="javascript:shenhe('<?php echo $v['article_id'];?>',1);" class="btn j-del" title="删除">审核</a>
				<?php }?>
				
				
					</td>
			</tr>
			
<?php } ?>
			
		</tbody>

	</table>
	<!-- end wxtables -->
	<div class="tables-btmctrl clearfix">
		<hr>
		<div class="mgt10">
			<div class="paginate">{$page}</div>
			<!-- end paginate -->
		</div>
	</div>
	<!-- end tables-btmctrl -->
</div>


<script>
function del(id,status){
	//询问框
	if(status == 0){
		var txt = '你确定要删除该文章吗？';
	}else{
		var txt = '你确定要恢复该文章吗？';
	}
	
	layer.confirm(txt, {
	    btn: ['确定','我再想想'] //按钮
	}, function(){
		var url = "/admin/article/del/?id="+id+"&status="+status;
		AjaxUrl(url);
	}, function(){
	});
}

function shenhe(id,status){
	//询问框
	if(status == 1){
		var txt = '你确定要审核通过该文章吗？';
	}else{
		var txt = '你确定要不通过该文章吗？';
	}
	
	layer.confirm(txt, {
	    btn: ['确定','我再想想'] //按钮
	}, function(){
		var url = "/admin/article/shenhe/?id="+id+"&status="+status;
		AjaxUrl(url);
	}, function(){
	});
}

function chakan(id){
	var url = '/mobile/article/qrcodeapi?url=<?php echo get_domain();?>/mobile/article?article_id='+id;
	//在这里面输入任何合法的js语句
	layer.open({
	  type: 1, //page层
	  area: ['400px', '400px'],
	  title: '拿出手机,扫描我吧',
	  shade: 0.6, //遮罩透明度
	  moveType: 1, //拖拽风格，0是默认，1是传统拖动
	  shift: 3, //0-6的动画形式，-1不开启
	  shadeClose:true,
	  content: '<div style="padding:15px 50px;"><img src="'+url+'"  width="300" height="300" ></div>'
	});        
}
</script>